<template>
  <div class="app">
    <router-view></router-view>
  </div>
</template>

<script setup>
import { onMounted, onUnmounted } from 'vue';
import emitter from '@/utils/mitt'
import { useRouter } from 'vue-router';

const router = useRouter()

// 监听
onMounted(() => {
  emitter.on('to-login', (e) => {
    if (e) {
      router.push('/login')
    }
  })
})

// 移除
onUnmounted(() => {
  emitter.off('on-button-click', () => { })
})

</script>

<style lang="less" scoped>
.app {
  background-color: #f1f3f8;
  padding: 0;
  margin: 0;
}
</style>